# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=doona
pkgver=145.7a4796c
pkgrel=4
groups=('blackarch' 'blackarch-fuzzer' 'blackarch-exploitation')
pkgdesc='A fork of the Bruteforce Exploit Detector Tool (BED).'
arch=('any')
url='https://github.com/wireghoul/doona'
license=('GPL2')
depends=('perl')
makedepends=('git')
source=("git+https://github.com/wireghoul/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" Docs/*
  install -Dm 644 Docs/gpl.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm -rf Docs "$pkgdir/usr/share/doc/$pkgname/gpl.txt"

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec perl $pkgname.pl "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

